package JunitTests;

import static org.junit.Assert.*;

import java.util.Date;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import uk.ac.glasgow.demosocs.Election;
import uk.ac.glasgow.demosocs.impl.VotingSystemStub;
import uk.ac.glasgow.demosocs.impl.election.ElectionImpl;
import uk.ac.glasgow.demosocs.users.Electorate;

public class VotingSystemStubTest {
	VotingSystemStub mysystem = new VotingSystemStub();

	public void setUp() throws Exception {
	}

	public void tearDown() throws Exception {
	}

	public void testCreateElection() {
		
		assertNull(mysystem.getCurrentElection());
		
		
		mysystem.createElection("election1", "type1");
		
		assertTrue(mysystem.getElections().isEmpty());
		
		Date date1 = new Date();
		System.out.println(date1);
		//mysystem.editElection(date1, date1, date1, "electorate1");
		for(Election e : mysystem.getElections()){
			System.out.println(e.getEID() + "        "+e.getStart()+"   "+ e.getEnd());
		
		}
		
	}

	public void testElectorateList(){
		
	}
	
	public void testEditElection(){
		mysystem.createElection("election3", "type3");
		Date date = new Date(2011,01,01);
		
		
		Electorate ele = new Electorate("ok");
		mysystem.addElectorateToList(ele);
		assertNotNull(mysystem);
		
		mysystem.editElection(date, date, date, "ok");
		assertTrue(mysystem.getElectorateByID("1").getElectorateID().equals("ok"));
		System.out.println(mysystem.getCurrentElection().getEnd());
	}

}
